<script setup lang="ts">
import { ref } from 'vue'
import { channels } from './api'
// api封装
const list = ref<{ id: number; name: string }[]>([])

const getData = async () => {
  const res = await channels()
  list.value = res.data.channels

  console.log(res.data.channels)
}
</script>

<template>
  <div class="page-page">
    <button @click="getData">调用接口</button>
    <ul>
      <li v-for="item in list" :key="item.id">
        {{ item.name }}
      </li>
    </ul>
  </div>
</template>

<style scoped></style>
